package org.example;

import java.util.Scanner;

public class test1 {
    public static void main(String[] args) {
        //  输入一个整数，判断是否是回文数。
        /*Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个整数:");
        int n = scanner.nextInt();
        int temp=n;
        int num=0;
        while (n!=0){
            int ge=n%10;
            n=n/10;
            num=num*10+ge;
        }
        System.out.println(num);
        System.out.println(temp==num);*/
        /*//求算法的商和余数，不用乘法除法和%
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个被除数：");
        int divided = sc.nextInt();
        System.out.println("请再输入一个除数：");
        int divisor = sc.nextInt();
        int count = 0;
        while (divided >= divisor ) {
            divided -= divisor;
            count++;
        }
        System.out.println("商:"+count);
        int a=divided;
        System.out.println("余数:"+a);*/
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个字符串");
        String str = sc.next();
        int bigCount = 0;
        int smallCount = 0;
        int numberCount = 0;
        for (int i = 0; i < str.length(); i++) {
            //获取字符串中的每一个字符 索引 字符串.charAt(索引)
            char c = str.charAt(i);
            if (c > 'A' && c < 'Z') {
                bigCount++;
            } else if (c > 'a' && c < 'z') {
                smallCount++;
            } else if (c > '0' && c < '9') {
                numberCount++;
            }
        }
        System.out.println("大写字母个数为：" + bigCount);
        System.out.println("小写字母个数为：" + smallCount);
        System.out.println("数字个数为：" + numberCount);
  /*      reverseString(str);
        System.out.println("反转后的字符串为：" +  reverseString(str));*/
        StringBuilder sb=new StringBuilder(str);
        sb.reverse();
        System.out.println("反转后的字符串为："+sb);
    }

    /*private static String reverseString(String str) {
      if (str == null) {
            return null;
        }
        String result="";
        for(int i=str.length()-1;i>=0;i--) {
            char c=str.charAt(i);
            //result+=c;
            result=sb.append(c);
        }
        return result;
    }*/
}